﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
using System.ComponentModel;
namespace CoreData
{
    public class TempStudentDeposit
    {
        public long ID { get; set; }
        public long TempStudentID { get; set; }
        public long BranchID { get; set; }
        [Description("Tiền cọc")]
        public long Money { get; set; }
        [Description("Ngày đặt cọc")]
        public DateTime DepositDate { get; set; }
        [Description("Tháng chọn học")]
        public int SelectMonth { get; set; }
        [Description("Năm chọn học")]
        public int SelectYear { get; set; }
        [Description("Ghi chú")]
        public string Note {get;set;}
        [Description("Ngành đăng ký")]
        public string BranchExt {get;set;}
        [Description("Học viên")]
        public string NameExt { get; set; }
        
        public TempStudentDeposit()
        {
            DepositDate = DateTime.Now;
        }

        static TempStudentDeposit DynamicCast<T>(object row_data, object row_header) where T : TempStudentDeposit
        {
            // row_data : DataRow
            // row_header : DataColumnCollection
            TempStudentDeposit ret = new TempStudentDeposit();
            DataRow dt = (DataRow)row_data;

            foreach (DataColumn column in (DataColumnCollection)row_header)
            {
                switch (column.ColumnName)
                {
                    case "ID":
                        ret.ID = ConvertObject.ToLong(dt[column]);
                        break;
                    case "TempStudentID":
                        ret.TempStudentID = ConvertObject.ToLong(dt[column]);
                        break;
                    case "BranchID":
                        ret.BranchID = ConvertObject.ToLong(dt[column]);
                        break;
                    case "Money":
                        ret.Money = ConvertObject.ToLong(dt[column]);
                        break;
                    case "DepositDate":
                        ret.DepositDate = ConvertObject.ToDateTime(dt[column]);
                        break;
                    case "BranchName":
                        ret.BranchExt = ConvertObject.ToString(dt[column]);
                        break;
                    case "TempStudentName":
                        ret.NameExt = ConvertObject.ToString(dt[column]);
                        break;
                    case "Note":
                        ret.Note = ConvertObject.ToString(dt[column]);
                        break;
                    case "SelectMonth":
                        ret.SelectMonth = ConvertObject.ToInt(dt[column]);
                        break;
                    case "SelectYear":
                        ret.SelectYear = ConvertObject.ToInt(dt[column]);
                        break;
                    
                    default:
                        break;
                }
            }

            return ret;
        }

    }
}
